<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><PHP>echo getSysTitle();</PHP></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="__JS__/jquery-1.6.2.min.js"></script>
<link rel="stylesheet" href="__JS__/validfrom/css/style.css" type="text/css" media="all" />
<link href="__JS__/validfrom/css/demo.css" type="text/css" rel="stylesheet" />

<link href="__JS__/validfrom/plugin/jqtransform/jqtransform.css" type="text/css" rel="stylesheet" />


<script type="text/javascript" src="__JS__/validfrom/js/Validform_v5.2_min.js"></script>

<script type="text/javascript" src="__JS__/validfrom/plugin/jqtransform/jquery.jqtransform-min.js"></script>
<script type="text/javascript" src="__JS__/validfrom/plugin/swfupload/swfuploadv2.2-min.js"></script>
<script type="text/javascript" src="__JS__/validfrom/plugin/swfupload/Validform.swfupload.handler.js"></script>
<link href="__CSS__/table.css" rel="stylesheet" type="text/css" />
<script src="__JS__/popup/popup.js"></script>
<script src="__JS__/popup/user.js"></script>
<title>{$title|default=''}</title>
<script>
	$(document).ready(function(){
		
		$(".registerform").Validform({
			tiptype:function(msg,o,cssctl){
				if(!o.obj.is("form")){
					var objtip=o.obj.parents("td").next().find(".Validform_checktip");
					cssctl(objtip,o.type);
					objtip.text(msg);
				}

			},
			ajaxPost:true,
			callback:function(data){
				alert(data.info);
				if(data.status=="y"){
					parent.window.location.reload();
					//window.location.href="?g=Admin&m=Order&a=viewdetail&O_ID="+data.O_ID;
					/*setTimeout(function(){
						$.Hidemsg(); //公用方法关闭信息提示框;显示方法是$.Showmsg("message goes here.");
					},2000);
					*/
				}
			}
		});
		//得到地区
		$("#AR_L1").bind('change',function(){
			if($(this).val()==''){
				return false;
			}
			$("#AR_L2").empty();
			$("#AR_L2").append('<option value="">--市辖区--</option>');
			getArea('AR_L1',$(this).val(),'AR_L2');
		});
		$("#AR_L2").bind('change',function(){
			if($(this).val()==''){
				return false;
			}
			$('#AR_L3').empty();
			$('#AR_L3').append('<option value="">--区县--</option>');
			getArea('AR_L1|AR_L2',$("#AR_L1").val()+"|"+$(this).val(),'AR_L3');
		});
		$("#AR_L3").bind('change',function(){
			if($(this).val()==''){
				return false;
			}
			$('#AR_L4').empty();
			$('#AR_L4').append('<option value="">--乡镇--</option>');
			getAreaExtend($("#AR_L1").val()+"|"+$("#AR_L2").val()+"|"+$(this).val());
		});
		$("#sCr").bind("click",function(){
			var url="?g=Admin&m=User&a=cslist&t=c&f1=CU_ID&f2=CU_NAME";
			pDialog('',url,500,380);
		});
		$("#P_CHANNEL_ID").bind('change',function(){
			if($(this).val()>0){
				var txt=$(this).find("option:selected").text();  
				$("#P_CHANNEL").val(txt);
			}else{
				$("#P_CHANNEL").val('');
			}
			
		});
		$("#P_BRAND").bind('change',function(){
			if($(this).val()==''){
				return false;
			}
			$("#P_CATEGORY").empty();
			$("#P_CATEGORY").append('<option value="">--产品类型--</option>');
			getProduct('P_BRAND',$(this).val(),'P_CATEGORY');
		});
		$("#P_CATEGORY").bind('change',function(){
			if($(this).val()==''){
				return false;
			}
			$('#P_MODEL').empty();
			$('#P_MODEL').append('<option value="">--产品型号--</option>');
			getProduct('P_BRAND|P_CATEGORY',$("#P_BRAND").val()+"|"+$(this).val(),'P_MODEL');
		});
		function getProduct(stName,st,fl){
			$.ajax({
				   type: "POST",
				   url: "?g=Admin&m=Index&a=getProduct",
				   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
				   dataType:'json',
				   success: function(msg){
					 if(msg.sucess=='y'){
						var f=msg.fl;
						var data=msg.data;
						var _html=[];
						var k;
						for (k in data){
							_html.push('<option value="'+data[k]+'">'+data[k]+'</option>');
						}
						$("#"+f).append(_html.join(''));
					 }
				     
				   }
			});
		}
	});
	
	function getArea(stName,st,fl){
		$.ajax({
			   type: "POST",
			   url: "?g=Admin&m=Index&a=getArea",
			   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var f=msg.fl;
					var data=msg.data;
					var _html=[];
					var k;
					for (k in data){
						_html.push('<option value="'+data[k]+'">'+data[k]+'</option>');
					}
					
					$("#"+f).append(_html.join(''));
					
					for (k in data){
						_html.push('<li><a href="javascript:;">'+data[k]+'</a></li>');
					}
					$("#"+f+"_1").append(_html.join(''));
				 }
			     
			   }
		});
	}

	function setArea(stName,st,fl,v){
		$.ajax({
			   type: "POST",
			   url: "?g=Admin&m=Index&a=getArea",
			   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var f=msg.fl;
					var data=msg.data;
					var _html=[];
					var k;
					for (k in data){
						var _sel='';
						if(v==data[k]){
							_sel="selected";
						}
						_html.push('<option value="'+data[k]+'"  '+_sel+'>'+data[k]+'</option>');
					}
					
					$("#"+f).append(_html.join(''));
				 }
			     
			   }
		});
	}
	function setProduct(stName,st,fl,v){
		$.ajax({
			   type: "POST",
			   url: "?g=Admin&m=Index&a=getProduct",
			   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var f=msg.fl;
					var data=msg.data;
					var _html=[];
					var k;
					
					for (k in data){
						var _sel='';
						if(v==data[k]){
							_sel="selected";
						}
						_html.push('<option value="'+data[k]+'" '+_sel+'>'+data[k]+'</option>');
					}
					
					$("#"+f).append(_html.join(''));
				 }
			     
			   }
		});
	}
	
	function setAreaExtend(st,field){
		var url="st="+encodeURI(st)+'&rd='+Math.random()+"&isviewEmpty=y";
		$.ajax({
			   type: "POST",
			   url: "?g=Admin&m=Index&a=getAreaExtend",
			   data: url,
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var data=msg.data;
					var _html=[];
					var k;
					for (k in data){
						var _sel='';
						if(field==data[k]){
							_sel="selected";
						}
						_html.push('<option value="'+data[k]+'" '+_sel+'>'+data[k]+'</option>');
					}
					$("#AR_L4").append(_html.join(''));
				 }
			   }
		});
	}
	function getAreaExtend(st){
		var url="st="+encodeURI(st)+'&rd='+Math.random();
		$.ajax({
			   type: "POST",
			   url: "?g=Admin&m=Index&a=getAreaExtend",
			   data: url,
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var data=msg.data;
					var _html=[];
					var k;
					for (k in data){
						_html.push('<option value="'+data[k]+'">'+data[k]+'</option>');
					}
					$("#AR_L4").append(_html.join(''));
				 }
			   }
		});
	}
</script>
<style>
body{background-color:#ffffff}
</style>
</head>
<body >

<div >

	<form action="?g=Admin&m=Order&a=editCr" method="post" class="registerform" id="roleForm"  >
		<fieldset>
    		<legend >顾客信息</legend>
    		
    		<table width="100%">
    			 
                <tr>
                    <td class="need" style="width:10px;"></td>
                    <td style="width:70px;">姓名</label>：</td>
                    <td style="width:300px;">
                    
                    <input type="text" id="U_RNAME" name="data[U_RNAME]" datatype="*" value="{$uData.CU_NAME}" class="inputxt"  errormsg="该用户已注册，请选择用户"  nullmsg="请输入姓名"  />
                  
                    </td>
                    <td><div class="Validform_checktip">请输入姓名</div></td>
                </tr>
              
                <tr>
                    <td class="need"></td>
                    <td>手机：</td>
                    <td>
                    <input type="text" id="U_MOBILE" name="data[U_MOBILE]" value="{$uData.O_MOBILE}" class="inputxt mobile" datatype="m" ignore="ignore" errormsg="手机号码格式错误！" />
                    </td>
                    <td><div class="Validform_checktip">请输入手机</div></td>
                </tr>
               
                 <tr>
                    <td class="need"></td>
                    <td>固定电话：</td>
                    <td><input type="text" id="U_PHONE" name="data[O_PHONE]" value="{$uData.O_PHONE}" class="inputxt"  /></td>
                    <td><div class="Validform_checktip">请输入固定电话</div></td>
                </tr>
                
                 <tr>
		                  <td class="need" style="width:0px;"></td>
		                  <td style="width:80px;line-height:30px;">地址</td>
		                  <td style="width:;">
		                  <table border="0" cellpacing="0" cellpadding="0">
							<tr>
								<td width="25%">
									<select size=1 id="AR_L1" name="data[AR_L1]" datatype="*" style="width:120px;height:20px;">
										<option value="">--省市--</option>
										<volist name="AR_L1" id="vo">
										<option value="{$vo}" <if condition="$uData.AR_L1 eq $vo">selected</if>>{$vo}</option>
										</volist>
									</select>
								</td>
							
								<td width="25%">
									<select size=1  datatype="*"  id="AR_L2" name="data[AR_L2]" style="width:120px;height:20px;">
										<option value="">--市辖区--</option>
									</select>
								</td>
								<td width="25%" >
									<select size=1 datatype="*" id="AR_L3" name="data[AR_L3]" style="width:120px;height:20px;">
										<option value="">--区县--</option>
									</select>
								</td>
								<td width="25%">
                                <select class="select2"  id="AR_L4" name="data[AR_L4]" style="width:120px;height:20px;">
									<option value="">--乡镇--</option>
								</select>
                            	</td>
								</tr>
								
						</table>
		                  </td>
		                  <td><div class="Validform_checktip" id="Validform_checktip_AR_L" style="line-height:30px;">请输入地址</div></td>
		              </tr>
		               <tr>
		                  <td class="need" style="width:0px;"></td>
		                  <td style="width:80px;line-height:30px;">详细地址</td>
		                  <td style="width:;">
		                   <input type=text id="O_ADDRESS" name="data[O_ADDRESS]" value="{$uData.O_ADDRESS|default=''}" class="inputxt"  style="width:230px;">
		                  </td>
		                  <td><div class="Validform_checktip" id="Validform_checktip_O_ADDRESS" style="line-height:30px;">请输入详细地址</div></td>
		              </tr>
		               
                
            </table>
		</fieldset>
		
    	<fieldset class="action">
    	<input type="hidden" name="data[O_ID]" value="{$uData.O_ID}">
    	<input type="hidden" name="o_id" value="{$o_id}">
    	<input type="hidden" name="op" value="1">
    	<input type="hidden" name="data[CU_ID]" value="{$uData.CU_ID}">
    	<input type="submit" name="submit" id="submit" value="保存" />
    	</fieldset>
    	
	</form>
</div>


<if condition="$uData.AR_L1 neq ''">
	
	<script>
	
		$("#AR_L2").empty();
		$("#AR_L2").append('<option value="">--市辖区--</option>');
		setArea('AR_L1','{$uData.AR_L1}','AR_L2','{$uData.AR_L2}');
		
		$('#AR_L3').empty();
		$('#AR_L3').append('<option value="">--区县--</option>');
		setArea('AR_L1|AR_L2',"{$uData.AR_L1}|{$uData.AR_L2}",'AR_L3','{$uData.AR_L3}');
		$('#AR_L4').empty();
		$('#AR_L4').append('<option value="">--乡镇--</option>');
		setAreaExtend("{$uData.AR_L1}|{$uData.AR_L2}|{$uData.AR_L3}","{$uData.VT_NAME}");
	</script>
	
</if>

</body>
